<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>


</head>
<body>
<div id="app">
  <input type="text" v-focus data-id="abcd">
</div>
</body>
<script>
  Vue.directive('focus', {
    // el 是dom对象，不过控制台的输出可能不同唉。。。
    inserted: function (el) {
      console.log(el)
      console.log(el.dataset)
      console.log(typeof el)
      el.focus()
    }
  })
  var vm = new Vue({
    el: "#app",
    data(){return {}}
  })
</script>
</html>